package suanfa;

public class RandomTest {
    public static void main(String[] args) {
        int randomTimes = 1000000;
        int[] nums = new int[10];
        for (int i = 0; i < randomTimes; i++) {
            int idx = (int) (Math.random() * 10D);
            nums[idx]++;
        }
        for (int i = 0; i < nums.length; i++) {
            System.out.println(i + "出现的概率为" + nums[i]/(double)randomTimes + "%");
        }
    }
}
